-
Construct a loop which will repeat some statements 100 times.
Use a control variable called i. -
Give the value which would remain in i after the following code has executed:
int i = 0 ;
while ( i == 1 ) {
i = i + 1 ;
}
Answers
-
int i;
for ( i = 0 ; i < 100 ; i++ )
{
/* Code to be repeated here */
} -
i would be left with the value 0, this is because the value in the while is not executed as the expression is always equal to 0.